let app = getApp()
Component({
    properties: {
        vueId:Number
      },
      data:{
        title: "专栏详情",
        tabbarList: [ {
            title: "介绍"
        }, {
            title: "内容"
        } ],
        seriesList: [],
        seriesInfo: {},
        tabbarCur: 0,
        payBtnShow: !0,
        videoAd: null,
        moneySign:'¥'
      },
    lifetimes: {
        attached: function () {
          var that=this
          wx.request({
            url: app.globalData.siteroot,
            data: {
              do:'Knowledge_getColumn',
              column_id:that.data.vueId,
              user_id:wx.getStorageSync('user_id')
            },
            success: function(res) {
              that.setData({
                seriesInfo:res.data.data,
                seriesList:res.data.data.column_content
              })
              var sharedata=[];
                 var share_title=res.data.data.name
                 if(typeof(res.data.data.share_title)!='undefined'){
                   if(res.data.data.share_title!=''&&res.data.data.share_title!=null){
                      share_title=res.data.data.share_title
                   }
                 }
                 sharedata['title']=share_title,
                 sharedata['cover']=typeof(res.data.data.share_cover)!='undefined'?res.data.data.share_cover:'',
                 that.triggerEvent('changeshare',sharedata) 
            }
          })
       }
      },
    methods: {
      jumpdetail:function(e){
        var id=e.currentTarget.dataset.id;
         wx.navigateTo({ 
           url: '/yb_shopv2/native/all/index?type=course_detail&content_type=1&id='+id,
        })  
       },
      nowbuy:function(){
        var order=[];
        var cacheParams={
          id:this.data.seriesInfo.goods_id,
          goods_id:this.data.seriesInfo.goods_id,
          title:encodeURIComponent(this.data.seriesInfo.name),
          goods_name:this.data.seriesInfo.name,
          pic:this.data.seriesInfo.image,
          count:1,
          num:1,
          template_id:0,
          image:encodeURIComponent(this.data.seriesInfo.image), 
          skuId:0,
          sku_id:0,
          cate:[], 
          shoppingId:0, 
          price:this.data.seriesInfo.price,
          hideCount:!0
        }
        order.push(cacheParams)
        wx.setStorageSync('confirmorder',order)
        wx.navigateTo({  
          url: '/yb_shopv2/native/all/index?type=confirm_order&params='+JSON.stringify([cacheParams ])+"&order_type=1&good_type=4&page_type=series",
       })
      },
      choose:function(e){
        this.setData({
          tabbarCur:e.detail.cur
        })
     
      }
    }
});
